#ifndef BIRDSPRITE_H
#define BIRDSPRITE_H
#include<QGraphicsItem>
#include<QObject>
extern QTimer globalTicker;
class BirdSprite :public QObject, public QGraphicsItem
{
    Q_OBJECT
    float x,y,g,vy,dx,dy,angle;
    int selfTick;
    int lifeTick;
    QMovie*q;
    void waitingAdvance();
    void flyingAdvance();
    void randomFlyingAdvance();
    void deadAdvance();
    void (BirdSprite::*advanceMethod)();
public:
    BirdSprite(float x0,float y0,float g0);
    ~BirdSprite();
    void paint(QPainter*painter, const QStyleOptionGraphicsItem*option, QWidget*widget = nullptr);
    QRectF boundingRect()const;
    void advance(int phase);
    QPainterPath shape() const;
signals:
private slots:
    void jump(float);
    void onGameOver();
    void onRestart();
    void onGameBegin(int gamemode);
    void tickCnt();
};

#endif // BIRDSPRITE_H
